package com.ts.filesystem.controller;

import com.ts.api.manage.filesystem.FileSystemControllerApi;
import com.ts.filesystem.service.FileSystemService;
import com.ts.framework.domain.filesystem.response.UploadFileResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件管理控制层
 */
@RestController
@RequestMapping("/filesystem")
public class FileSystemController implements FileSystemControllerApi {

    @Autowired
    FileSystemService fileSystemService;

    /**
     * 文件上传
     * @param file
     * @param filetag
     * @param businesskey
     * @param metadata
     * @return
     */
    @Override
    @PostMapping("/upload")
    public UploadFileResult uploadFile(MultipartFile file, String filetag, String businesskey, String metadata) {
        return fileSystemService.uploadFile(file, filetag, businesskey, metadata);
    }
}
